package com.example.rest_client_projet;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by richard on 18/03/14.
 */
public class Employe {

    Employe(){

    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    int id;
    String nom;
    String prenom;
    String telephone;
    String date;


    public static Employe fromJson(String s) {
        return new Gson().fromJson(s, Employe.class);
    }
    public static Employe[] arrayfromJson(String s) {
        return new Gson().fromJson(s, Employe[].class);

    }
    //As list
    /*

     */
    public static List<Employe> listfromJson(String s) {
        return new Gson().fromJson(s, new TypeToken<List<Employe>>(){}.getType());

    }

    public String toString(){
        //return new Gson().toJson(this);
        return (this.getNom() + " " + this.getPrenom());
    }

}
